package com.zirenx.common.config;

import com.jfinal.kit.Prop;
import com.jfinal.kit.PropKit;
import com.zirenx.utils.StringUtils;

public abstract class ConstantConfig {
	
	private static Prop p ;

	// 先加载开发环境配置，再追加生产环境的少量配置覆盖掉开发环境配置
	static void load() {
		if (p == null) {
			p = PropKit.use("config.properties");
			boolean deploy = false;
			if (p == null){
				deploy = true;
			}else {
				String appDeploy = p.get("app.deploy");
				if (!StringUtils.isEmpty(appDeploy) && appDeploy.equals("1")){	//正式环境
					deploy = true;
				}
			}
			if (deploy){
				p = PropKit.use("config-pro.properties");
			}
		}
	}

	public static Prop getProp(){
		load();
		return p;
	}

	/** 后台页面 */
	public static final String ADMIN_PATH = "/WEB-INF/admin/";

	public static final String UPLOAD_PATH = getProp().get("app.uploadPath","/upload");
}
